package com.akxy.pt.tsdb.conf;

import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.InfluxDBClientFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Mengfly
 */

@Configuration
public class InfluxDbConfiguration {

    @Autowired
    private InfluxDbConfig config;


    @Bean
    public InfluxDBClient influxDbClient() {
        return InfluxDBClientFactory.create(
                config.getUrl(),
                config.getToken().toCharArray(),
                config.getOrg(),
                config.getBucket()
        );
    }
}
